/*
 * @Author: qin
 * @Date:   2018-08-28
 * +----------------------------------------------------------------------
 * | admin [ 后台管理系统公共配置信息 ]
 * | 勘察设计院承接相关接口模块
 * +----------------------------------------------------------------------
 */
layui.define(['jquery', 'configure', 'configureCom','bluebird'], function (exports) {
    var configure = layui.configure;
    var configureCom = layui.configureCom;
    var accept = {
        param: {
            data: {
                finalAmt: 0,
                keyPositionMembers: [
                    {
                        certificateInfo: '',
                        constraint: '',
                        memberId: '',
                        memberName: '',
                        role: '项目负责人',
                        speciatyId: '',
                        speciatyName: ''
                    }
                ],
                planEndDate: '',
                planStartDate: '',
                projBdstId: -1
            }
        },
        promiseSearch: function () {
            // 承接标段信息查询
            return new Promise(function (resolve, reject) {
                var confirmUrl = configure.SURVEYDESIGN_PACKAGE_DETAIL_HTTP.replace('{projBdstId}', accept.param.data.projBdstId);
                configureCom.getAjax(confirmUrl, {}).then(function (res) {
                    resolve(res);
                }, function (err) {
                    reject(err);
                });
            });
        },
        promiseSubmit: function () {
            //标段承接
            return new Promise(function (resolve, reject) {
                var confirmUrl = configure.SURVEYDESIGN_ACCEPT_HTTP;
                configureCom.postAjax(confirmUrl, JSON.stringify(accept.param.data)).then(function (res) {
                    resolve(res);
                }, function (err) {
                    reject(err);
                });
            });
        }
    };
    exports('accept', accept);
});